<%@page import="org.jgs1904.enums.PostTypeEnum"%>
<%@page import="org.jgs1904.enums.PostTypeEnum"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>帖子详情页</title>
<style type="text/css">
	#container {
		width: 1000px;
		border: solid 2px green;
		margin: 50px auto;
		padding: 30px;
	}
	
</style>
</head>
<body>
	<div id="container">
		<div>标题：${ post.title }</div>
		<div>类别：${ PostTypeEnum.values()[post.type].getDesc() }</div>
		<div>作者：${ post.nickname }</div>
		<div>时间：<fmt:formatDate value="${ post.create_time }" pattern="yyyy年MM月dd日  HH点mm分"/></div>
		<hr>
		<div style="width: 94%;border: solid 1px gray;padding: 3%">${ post.content }</div>
		<hr>
		<div>评论：</div>
		<c:if test="${ onlineUser != null }">
			<form action="${ bp }/comment?method=add&post_id=${ post.id }" method="post">
				<textarea rows="5" cols="50" name="content">${ comment.content }</textarea>
				<br>
				<input type="submit" value="发表评论">
				<br> 
				<span style="color:red">${ message }</span>
			</form>
		</c:if>
		<c:if test="${ onlineUser == null }">
			<a href="${ bp }/user/login.jsp">登陆后才可评论！</a>
		</c:if>
		<c:forEach items="${ post.comment_list }" var="comment" varStatus="vs">
			<div>${ vs.count }.${ comment.nickname }：${ comment.content }（<fmt:formatDate value="${ comment.create_time }" pattern="yyyy年MM月dd日  HH点mm分"/>）</div>
		</c:forEach>
		
	</div>
</body>
</html>